import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
import { User } from 'src/user/entities/user.entity'

@Entity()
export class Todolist {
  // 主键，自动生成
  @PrimaryGeneratedColumn()
  _id: number

  // 待办标题字段
  @Column()
  title: string

  // 待办是否完成
  @Column({ default: false })
  completed: boolean

  @ManyToOne(() => User, user => user.todolist)
  @JoinColumn()
  user: User[]
}
